/**==============================================================================
            Copyright (c) 2013 Moritz Hader, Marcel Schrder
            All Rights Reserved.

	@file  HeimdallGLView.java

	@brief  This class provides the android implementation of the EGL Display. 
	It provides the canvas or surface one uses to draw on so to speak.

  This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
==============================================================================*/
package de.ibm.dhbw.heimdall.egl;

import android.content.Context;
import android.graphics.PixelFormat;
import android.opengl.GLSurfaceView;

/**
 *
 * @author moritzhader
 *
 */
public class HeimdallGLView extends GLSurfaceView{

	public HeimdallGLView(Context context,boolean gltransculency, int glstencil, int gldepth) {
		super(context);
		
		/*
		 * The transculency allows the GLSurfaceView to support alpha-bits in the surface-buffer.
		 * This causes the background to let elements that are behind the glsurfaceview to shine
		 * through. In other words, the background of our view is transparent
		 */
		if(gltransculency){
			
			/*
			 * By setting the holders pixelformat to transculent, we tell the GLSurfaceView to
			 * interpret the surface-buffer with resprect to the alpha-bits
			 */
			this.getHolder().setFormat(PixelFormat.TRANSLUCENT);
		}	
		
		this.setEGLContextFactory(new HeimdallEGLContextFactory());
		
		this.setEGLConfigChooser(new HeimdallEGLConfigChooser(8, 8, 8, 8, gldepth, glstencil));
	}

}
